// 有效率更高的桶排序方法
class Solution {
public:
    int hIndex(vector<int>& citations) {
        sort(citations.begin(),citations.end(),greater<int>());
        int count = 0, cur_val = INT_MAX;
        do
        {
            count++;
            if(citations.empty()) break;
            cur_val = citations[0];
            citations.erase(citations.begin());
        } while(count <= cur_val);
        return count - 1;
    }
};
